创建用户及指定访问目录useradd test -d /home/test -M
设置密码passwd test
将访问目录权限全部赋予用户chown -R test /home/test
将上层目录设置为root所有chown root /home
赋予权限给上层目录chmod 771 /home
Centos7限制用户访问指定目录
![](https://img-home.csdnimg.cn/images/20240711042549.png)
创建用户及指定访问目录useradd test -d /home/test -M
设置密码passwd test
将访问目录权限全部赋予用户chown -R test /home/test
将上层目录设置为root所有chown root /home
赋予权限给上层目录chmod 771 /home